package com.woniuxy.controller;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniuxy.entity.Staffeva;
import com.woniuxy.entity.StaffevaDto;
import com.woniuxy.entity.Staffevas;
import com.woniuxy.entity.StaffevasDto;
import com.woniuxy.service.StaffevaService;
import com.woniuxy.service.StaffevasService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (Staffeva)表控制层
 *
 * @author makejava
 * @since 2021-05-15 14:52:40
 */
@RestController
@RequestMapping("staffevas")
public class StaffevasController {
    /**
     * 服务对象
     */
    @Resource
    private StaffevasService staffevasService;



    /**
     * 查询所有数据
     *
     * @param
     * @return 单条数据
     */
    @GetMapping("selectAll")
    public PageInfo<Staffevas> selectAll(int startpage, int pagesize){
        PageHelper.startPage(startpage,pagesize);
        Page<Staffevas> page = (Page<Staffevas>) this.staffevasService.queryAll();
        PageInfo<Staffevas> pageInfo = new PageInfo<>(page);
        return pageInfo;
    }

    /**
     * 模糊查询数据
     *
     * @param
     * @return 单条数据
     */
    @PostMapping("search")
    public PageInfo<Staffevas> search(@RequestBody StaffevasDto StaffevasDto){
        PageHelper.startPage(StaffevasDto.getPage(),StaffevasDto.getLimit());
        Page<Staffevas> page =(Page<Staffevas>) this.staffevasService.search(StaffevasDto.getStaffevas());
        PageInfo<Staffevas>pageInfo = new PageInfo<>(page);
        return pageInfo;
    }





}
